package com.atguigu.gmall.sms.controller;

import com.alibaba.fastjson.JSON;
import com.atguigu.gmall.common.bean.PageParamVo;
import com.atguigu.gmall.common.bean.ResponseVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/sms")
public class TestFeignController {
    //test1?username=xx&password=xxx
    @GetMapping("/test1")
    public ResponseVo test1(String username,String password){
        log.info("test1接口被访问了，参数:username = {}, password = {}" ,
                    username , password);
        return ResponseVo.ok("test1的响应");
    }
    //test2/{id}
    @GetMapping("/test2/{id}")
    public ResponseVo test2(@PathVariable("id") String id){
        log.info("test2接口被访问了，参数:id = {}" ,
                id );
        return ResponseVo.ok("test2的响应");
    }

    //test3  请求体
    @PostMapping("/test3")
    public ResponseVo test3(@RequestBody PageParamVo paramVo){
        log.info("test3接口被访问了，参数:paramVo = {}" ,
                JSON.toJSONString(paramVo) );
        return ResponseVo.ok("test3的响应");
    }
    //pojo入参
    @GetMapping("/test4")
    public ResponseVo test4(PageParamVo paramVo){
        log.info("test4接口被访问了，参数:paramVo = {}" ,
                JSON.toJSONString(paramVo));
        return ResponseVo.ok("test4的响应");
    }
}
